package com.example.batch.process;

import com.example.batch.dto.IdDto;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.stereotype.Component;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2021/7/17 20:49
 */
@Component
public class IdFilterProcess implements ItemProcessor<IdDto, IdDto> {

    @Override
    public IdDto process(IdDto idDto) throws Exception {
        String id=idDto.getId();
        if(id.charAt(id.length()-1) %2 ==0){
            return idDto;
        }
        //为null 表示过滤
        return null;
    }
}
